// 解析 URL 查询参数的函数
function getQueryParameter(param) {
    const urlParams = new URLSearchParams(window.location.search);
    return urlParams.get(param);
}

function loadVideo() {
    // 获取查询参数中的视频信息
    const videoUrl = getQueryParameter("url");
    const videoTitle = getQueryParameter("title");
    const videoDescription = getQueryParameter("description");
    const videoCategory = getQueryParameter("category");

    // 设置页面元素的内容
    document.getElementById("video-player").src = videoUrl;
    document.getElementById("video-title").innerText = decodeURIComponent(videoTitle);
    document.getElementById("video-description").innerText = decodeURIComponent(videoDescription);
    document.getElementById("video-category").innerText = "分类: " + decodeURIComponent(videoCategory);
}

// 页面加载时调用加载视频的函数
window.onload = loadVideo;
